package com.spark.lola.statistics.entity;

import java.math.BigDecimal;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.spark.lola.support.common.util.TimeUtil;
import com.spark.lola.support.mybatis.entity.BaseModel;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 产品报表
 * </p>
 *
 * @author dengyejun
 * @since 2020-05-12
 */
@TableName("statistics_product")
@ApiModel(value="Product对象", description="产品报表")
public class StatisticsProduct extends BaseModel implements Serializable {
    private static final long serialVersionUID=1L;
    public StatisticsProduct(){}
    public StatisticsProduct(Long productId,Date date){
        Integer month = TimeUtil.getMonth(date);
        Integer year = TimeUtil.getYear(date);
        this.parentId = productId;
        this.createDate = date;
        this.createMonth = month;
        this.createYear = year;
    }
    private Long parentId;

    @TableField(exist = false)
    @ExcelProperty("货品")
    private String parentName;

    @ApiModelProperty(value = "采购总额")
    @ExcelProperty("采购总额")
    private BigDecimal sales=BigDecimal.ZERO;

    @ApiModelProperty(value = "采购总重")
    @ExcelProperty("采购总重")
    private BigDecimal weight=BigDecimal.ZERO;

    @ApiModelProperty(value = "货运总重")
    @ExcelProperty("货运总重")
    private BigDecimal transportWeight=BigDecimal.ZERO;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @ApiModelProperty(value = "创建日期 yyyy-MM-dd")
    @ExcelProperty("日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createDate;

    @ApiModelProperty(value = "创建月份 yyyyMM")
    @ExcelProperty("月份")
    private Integer createMonth;

    @ApiModelProperty(value = "创建年份yyyy")
    @ExcelProperty("年份")
    private Integer createYear;


    public String getParentName() {
        return parentName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }
    
    public BigDecimal getSales() {
        return sales;
    }

    public void setSales(BigDecimal sales) {
        this.sales = sales;
    }
    
    public BigDecimal getWeight() {
        return weight;
    }

    public void setWeight(BigDecimal weight) {
        this.weight = weight;
    }
    
    public BigDecimal getTransportWeight() {
        return transportWeight;
    }

    public void setTransportWeight(BigDecimal transportWeight) {
        this.transportWeight = transportWeight;
    }
    
    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
        
    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
    
    public Integer getCreateMonth() {
        return createMonth;
    }

    public void setCreateMonth(Integer createMonth) {
        this.createMonth = createMonth;
    }
    
    public Integer getCreateYear() {
        return createYear;
    }

    public void setCreateYear(Integer createYear) {
        this.createYear = createYear;
    }

    @Override
    public String toString() {
        return "Product{" +
            "parentId=" + parentId +
            ", sales=" + sales +
            ", weight=" + weight +
            ", transportWeight=" + transportWeight +
            ", updateTime=" + updateTime +
                ", createDate=" + createDate +
            ", createMonth=" + createMonth +
            ", createYear=" + createYear +
        "}";
    }
}
